package com.hub.esdemo.controller;

import com.hub.esdemo.dto.Dog;
import com.hub.esdemo.service.es.DogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @ author 飞天蝙蝠
 * @ date & time 2024/12/28 14:30
 */
@RestController
@RequestMapping("/dog")
public class DogController {

    @Autowired
    private DogService dogService;

    @PostMapping("/create")
    public Dog createDog(@RequestBody Dog dog) {
        return dogService.save(dog);
    }

    @GetMapping("/getDogById")
    public Dog getDogById(@RequestParam String id) {
        return dogService.getDogById(id);
    }
}
